require 'station'

module PCLink
  class Query
    def initialize(query)
      @query = query
    end
    
    def run(source, &block)
      result_set = run_simple_query(source)
      result_set.each {|result| yield(result)}
    end
    
    private 
    def run_simple_query(source)
      simple_query = "source." + @query
      puts "running simple query: #{simple_query}"
      eval (simple_query)
    end
  end
end